package com.test.DDT.util;

import com.github.javafaker.Faker;

import java.util.Locale;

public class RandomDataUtil {
    public static String getUnregisteredUsername() {
        Faker faker = new Faker();
        String username = faker.name().firstName();
        while (true) {
            if (username.length() > 4 && username.length() < 16) {
                Object ret = JDBCUtil.querySingleData("select count(*) from tz_user where user_name = '" + username + "'");
                if ((Long) ret == 0) {
                    break;
                }
            }
            username = faker.name().firstName();
        }
        return username;
    }

    public static String getUnregisteredPhone() {
        Faker faker = new Faker(Locale.CHINA);
        return faker.phoneNumber().cellPhone();
    }
}
